<?php

/**
 * sfGuardRegisterForm for registering new users
 *
 * @package    sfDoctrineGuardPlugin
 * @subpackage form
 * @author     Jonathan H. Wage <jonwage@gmail.com>
 * @version    SVN: $Id: BasesfGuardChangeUserPasswordForm.class.php 23536 2009-11-02 21:41:21Z Kris.Wallsmith $
 */
class sfGuardRegisterForm extends BasesfGuardRegisterForm
{
  /**
   * @see sfForm
   */
  public function configure()
  {
    $this->validatorSchema['phone'] = new sfValidatorString(array('max_length' => 30, 'required' => false));

    $this->widgetSchema['photo'] = new sfWidgetFormInputFile(array(
    'label' => 'Photo',
    ));
    $years = range(1930,date('Y')-18);
    $this->widgetSchema['birthday'] = new sfWidgetFormJQueryDate(array(
      'date_widget' => new sfWidgetFormDate(array('years'=>array_combine($years, $years)))
    ));


    $this->validatorSchema['photo'] = new sfValidatorFile(array(
      'required' => false,
      'path' => sfConfig::get('sf_upload_dir').'/photos',
      'mime_types' => 'web_images',
    ));
    $this->widgetSchema['birthday']->setAttribute('class', 'validate[required] select');
    $this->widgetSchema['activities_list']->setAttribute('class', 'validate[required] select');
    $this->widgetSchema['activities_list']->setAttribute('size', '4');
    $this->widgetSchema['username']->setAttribute('class', 'validate[required,custom[onlyLetterNumber],maxSize[30],ajax[ajaxUserCall]]');
    $this->widgetSchema['email_address']->setAttribute('class', 'validate[required,custom[email]]');
    $this->widgetSchema['first_name']->setAttribute('class', 'validate[required]');
    $this->widgetSchema['last_name']->setAttribute('class', 'validate[required]');
    $this->widgetSchema['password']->setAttribute('class', 'validate[required]');
    $this->widgetSchema['password_again']->setAttribute('class', 'validate[required,equals[sf_guard_user_password]]');
    $this->widgetSchema['interests']->setAttribute('class', 'validate[required]');
  }
}
